UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '10EdGT71tvrkRWHkgTN72901Ok88HgMOVKgaVrUnFQs=' 
WHERE 
  key_id = '34d8f90b669d2c923cae3ed46c63bda36e906c1695ee1495053900b978be3f0d' 
  AND (
    token = '10EdGT71tvrkRWHkgTN72901Ok88HgMOVKgaVrUnFQs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034