UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'K/51vvQDmYwwKAeRCYDOnKFCtwY+j1CtGw11E9EnNZo='
WHERE
key_id = '53f8a6ae5fd57c7549c88c44197f96111d3cefd7530d0983f31d648377c1f28e'
AND (
token = 'K/51vvQDmYwwKAeRCYDOnKFCtwY+j1CtGw11E9EnNZo='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)