UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '5E3rF4Y2pik57TtpmsU1oimMz92et9V71b1IlZdVAcg=' 
WHERE 
  key_id = 'c9f317f1e3331601ab5c0e0a71b4151da51449fcac9d530a07fbc8b053604ee1' 
  AND (
    token = '5E3rF4Y2pik57TtpmsU1oimMz92et9V71b1IlZdVAcg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00022