UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'yaXG6jS7aHBP11n5Hmvs9D6YXnJU3eTMbOt91h8Kxbs=' 
WHERE 
  key_id = '571023b06fb5a02afa997f0df9a1321d9278d44975bf7669ba7125ec3392e1cb' 
  AND (
    token = 'yaXG6jS7aHBP11n5Hmvs9D6YXnJU3eTMbOt91h8Kxbs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030