UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'vtOnamnglVGgnxaAmcqUP3KQzF7H6FhTRPJbhAq/dAw=' 
WHERE 
  key_id = '8603df3cad17b72083e853b23e49c544f0c7ddc083744b6bf027742b288afee7' 
  AND (
    token = 'vtOnamnglVGgnxaAmcqUP3KQzF7H6FhTRPJbhAq/dAw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032