UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'KFrQ2W9awVa2CMlXhgp+gItuwLYRYmbC9/vrGyp/bTM=' 
WHERE 
  key_id = '8938ae5d6af75c9e4c7458887936648159c68647e4620dc645e0eb342ee9e7b1' 
  AND (
    token = 'KFrQ2W9awVa2CMlXhgp+gItuwLYRYmbC9/vrGyp/bTM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00044