UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '/A+46scPqjikKySf/H7tW26V5oPawKpM+qd3QrgZwOA=' 
WHERE 
  key_id = '3d8feefbfbb456d7de6bbd093df686dd71063b574cbe885e038e649e176284f1' 
  AND (
    token = '/A+46scPqjikKySf/H7tW26V5oPawKpM+qd3QrgZwOA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030