UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'kPirNIOqxfeXdMn1TbwrgkmGKU6XKArz1ZK1a5mpJHI='
WHERE
key_id = '9a7165fa45830ca9f7c0f51cebb1438a8998e681e4da67995b5cd8bb1d1487ec'
AND (
token = 'kPirNIOqxfeXdMn1TbwrgkmGKU6XKArz1ZK1a5mpJHI='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)