UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '9MkHLCg6L/lChdPV1K+V4SHVSzMGSi59QP9b/faU4lY=' 
WHERE 
  key_id = '9a8838daa4a7814e400ad63cbf0d717b3cec1d248965dafcd9640af65f591f94' 
  AND (
    token = '9MkHLCg6L/lChdPV1K+V4SHVSzMGSi59QP9b/faU4lY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00045