UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'eyNH9p0fc8FUyQEaVfFuP8Ad/7Mnw+rUDk+zkrqYRTo=' 
WHERE 
  key_id = '421026c31b39d956506b0240d0a29a53f7d2811ead1854df570c83f078d69b29' 
  AND (
    token = 'eyNH9p0fc8FUyQEaVfFuP8Ad/7Mnw+rUDk+zkrqYRTo=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00051