UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'lUoBPjzNbzHDPvxzi7flaw0gWck+r4pGjvYMUFrZeos=' 
WHERE 
  key_id = 'f885d526df54064aa6ae684680fb380dd7c162639ed07eecd166460bf83cf37b' 
  AND (
    token = 'lUoBPjzNbzHDPvxzi7flaw0gWck+r4pGjvYMUFrZeos=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034