UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '+w5cyh2OtCq8ZXZTE9Y2aFIKoaYFYPcfc0SfmwS3Vvw=' 
WHERE 
  key_id = '6d5b8d88744fa5b2d59e30b0c67b9cf7849fc351426cb437a955010eec6e09a9' 
  AND (
    token = '+w5cyh2OtCq8ZXZTE9Y2aFIKoaYFYPcfc0SfmwS3Vvw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00021