UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'SGL1vhkFlERoEx0dOJlbMwttlkAR3tnu++xfNr7uWEA=' 
WHERE 
  key_id = '1d177100859765a359d3a13ddd3ea363a6991744f7f453184fb653ba556f4526' 
  AND (
    token = 'SGL1vhkFlERoEx0dOJlbMwttlkAR3tnu++xfNr7uWEA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00023