UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'A9ZvwdTQo3BfjxI/BWjo5aXnqwvA8vjLLy9IqQUB/Vo='
WHERE
key_id = 'b4a33f6deeda3319734d8e7b0bd36a5e16a928d96fa9dde2a7c3df2d667542ae'
AND (
token = 'A9ZvwdTQo3BfjxI/BWjo5aXnqwvA8vjLLy9IqQUB/Vo='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)