UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '1r+AoevY7Xmlc0TjHeWMVC7nG1N5Rng0xeRU4la6we8=' 
WHERE 
  key_id = '8d1d1eb136b498947fb8138c68f1c8e444c665ea2a2957c9e598dc5a192c2dd8' 
  AND (
    token = '1r+AoevY7Xmlc0TjHeWMVC7nG1N5Rng0xeRU4la6we8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00021