UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'eCzo2E0UTq28glpzYWYluUdXEUKtWkidTC/4+k7as2w='
WHERE
key_id = '797817d8266d53f4665703bcf5e3014dbfb663abb483d9ab3acaffc74efa25fe'
AND (
token = 'eCzo2E0UTq28glpzYWYluUdXEUKtWkidTC/4+k7as2w='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)