UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'F0GyroP1edjfrg1rnv6yTNa449GddmKOF7OSkdrWll8=' 
WHERE 
  key_id = 'f60519ad8776456c8d4770c2a39f140ef0a89bedbfc0f3683c7b6165def1d37e' 
  AND (
    token = 'F0GyroP1edjfrg1rnv6yTNa449GddmKOF7OSkdrWll8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032