UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'w76L2HTxjgTEA68jpgLeFih9GzB7UwT1fR2jUUamuTc=' 
WHERE 
  key_id = 'b6245bd71ce223f4b0324c096a5dbafd8d6d3b4dd9783c2190305237f909e931' 
  AND (
    token = 'w76L2HTxjgTEA68jpgLeFih9GzB7UwT1fR2jUUamuTc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00026