UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'tHLNYdUC7FAFfuwe49c106HtQQI3V5Gkk+hhl1nS5ks='
WHERE
key_id = 'd108ae649b42174ea201b8f2091b454c125c3a2b8377ac38cba9cb37ca939b4b'
AND (
token = 'tHLNYdUC7FAFfuwe49c106HtQQI3V5Gkk+hhl1nS5ks='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)