UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'sNg2CCSWSbb8tNJT5fJIA3SOo4LMRhdPZpw0t6WeIp8=' 
WHERE 
  key_id = 'a9d4312037e10177b82ed62d14f7bddd19ca1fe47d854c7ff62dea200a489380' 
  AND (
    token = 'sNg2CCSWSbb8tNJT5fJIA3SOo4LMRhdPZpw0t6WeIp8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00041