UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'XdM2UfQRazRuJOx/SgegrVfGEwUG4kGRXHLCxZoV/bM='
WHERE
key_id = '1d1144816cac9b2e35be04af10c4875f51327fb1488a87de1aa4012076891e96'
AND (
token = 'XdM2UfQRazRuJOx/SgegrVfGEwUG4kGRXHLCxZoV/bM='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)