UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'rjvNbwI543ZA+Jizp/2ISCpwQPGriGb6Z01obokMX4Q=' 
WHERE 
  key_id = 'c9a5d754724d9218af2c901b654d2aaee4174c3e1427dc3534ae68593da41163' 
  AND (
    token = 'rjvNbwI543ZA+Jizp/2ISCpwQPGriGb6Z01obokMX4Q=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00024