UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'YAcu2wm9pMZQBGsaAest7oXu/wX5erWE4rf1btEgta8=' 
WHERE 
  key_id = 'fe5f6c118af290c28507071b16141caba4688fba361d9feafc84e9b99a27219a' 
  AND (
    token = 'YAcu2wm9pMZQBGsaAest7oXu/wX5erWE4rf1btEgta8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00029