UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'rRfkSfhlAsOprE4mE42a+lIEC0heCuqDSPycCwDU8iU=' 
WHERE 
  key_id = '9f2b0c587d7673c0d2a3a1d82b4b32debfffd17b41e65886308c6d31bfdd51bb' 
  AND (
    token = 'rRfkSfhlAsOprE4mE42a+lIEC0heCuqDSPycCwDU8iU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00023