UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'PezL+ACx0hz3q7hPCBWlYX3DmlVC94qH3JuDIgy8Gd4='
WHERE
key_id = 'b2e2bb3e7d430071a759b2cc5d31deee2787989ab4e268158bf333041f311969'
AND (
token = 'PezL+ACx0hz3q7hPCBWlYX3DmlVC94qH3JuDIgy8Gd4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)