UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'wy68S1pGzOzVvZmlzNryZl8e6nB7f3Or/Uc8QlwPQyo=' 
WHERE 
  key_id = '2ad437163b772585adf230740b43d7ed217e2f50abe09c506893527c83626a39' 
  AND (
    token = 'wy68S1pGzOzVvZmlzNryZl8e6nB7f3Or/Uc8QlwPQyo=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030