UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'x/kDz5QOheAEnawiBMbrAlYOZwQYqarplZlIe1EwIgc='
WHERE
key_id = '42f9ac25fcc24fc6b4c4665fdf4a5eb69c6e85b714965ebc7938fbf6b011c1e2'
AND (
token = 'x/kDz5QOheAEnawiBMbrAlYOZwQYqarplZlIe1EwIgc='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)