UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'FgGUDyvAXE/wymGi7JU63I33HNLUhRo1A6stRaZW5M8=' 
WHERE 
  key_id = '8091237f6abdd14274332a157a6bb3b9c0769295de73177b7f4f2c62bfc4b099' 
  AND (
    token = 'FgGUDyvAXE/wymGi7JU63I33HNLUhRo1A6stRaZW5M8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00049