UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'mw+6iFgMqKfetUfRO3eil4nASBGfW6yITCQBh7reZkA=' 
WHERE 
  key_id = '356905909ce33af55e82a20cbc2fcf6f8d30e235432e01e018ad1887501e7177' 
  AND (
    token = 'mw+6iFgMqKfetUfRO3eil4nASBGfW6yITCQBh7reZkA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00049