UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Bn4CXx0m7SinX/OqDvj9c8H8qTMP3a37NRx7uyeMJQ8=' 
WHERE 
  key_id = '693fa57c99fc0d6d2cf70a8b8faf9c4164db5e6acaef0164e0be3d79f64bdcf5' 
  AND (
    token = 'Bn4CXx0m7SinX/OqDvj9c8H8qTMP3a37NRx7uyeMJQ8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00065