UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'OIijgqGSVuaQF6JFXS7+7Mhvm3jsKtev9Teh5a/0TW8='
WHERE
key_id = 'df8c36ca0ed274db36efb94e181d7f5422c0e17f93e441d9c60ec3b3f03a5aa8'
AND (
token = 'OIijgqGSVuaQF6JFXS7+7Mhvm3jsKtev9Teh5a/0TW8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)