UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '6BH1ELdpu2LwkfRcycUVYKo2zEAmFlOzWrRcnqlNKBw='
WHERE
key_id = 'f381934d881975dff9d62b8b97fc8e52a5a5bfdbc3179e865788eda84b099686'
AND (
token = '6BH1ELdpu2LwkfRcycUVYKo2zEAmFlOzWrRcnqlNKBw='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)