UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'XRrB5Cyy+iqUd29I0/AIZOB6MOvuInFxPzBawteg4V0='
WHERE
key_id = 'f3ea31261c24994dd8a5d950eb0c4e25ad36c2892a84d896390c6fa1b0be4464'
AND (
token = 'XRrB5Cyy+iqUd29I0/AIZOB6MOvuInFxPzBawteg4V0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)