UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'kuPyiggC2EVl7wR5K5+PGjB3UDgGgtjJRdo/P78DQrg=' 
WHERE 
  key_id = 'd87201fbc621e0d40496c1e6a7a55204e1dbd504ffebf52aa202007930b01d03' 
  AND (
    token = 'kuPyiggC2EVl7wR5K5+PGjB3UDgGgtjJRdo/P78DQrg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00037