UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'NPwK53CDRYMes6SG4CARXc5YQW1k78a4A6UnNYwfcV4='
WHERE
key_id = '9057c9c30cd7543e0ab0a514620561ef3b471b29231bbd9a9106cdf359103e99'
AND (
token = 'NPwK53CDRYMes6SG4CARXc5YQW1k78a4A6UnNYwfcV4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)