UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'XGIZUotPfADUE39GdPBnjn/SZBpYL45LGbT8/pD/rzo='
WHERE
key_id = 'bf4d403c6729c3cd30e052f8eb4897b856e6a65af6b4ea0990d13d602788d154'
AND (
token = 'XGIZUotPfADUE39GdPBnjn/SZBpYL45LGbT8/pD/rzo='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)