UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'yscnclx2S385acUrwVU1w4akXx5YuFTagc0ZO+PMCkI='
WHERE
key_id = 'd6349e661a9f6d57341a44bb8fb912541cb0739cd7e71a0adcc6d33d4eca29bd'
AND (
token = 'yscnclx2S385acUrwVU1w4akXx5YuFTagc0ZO+PMCkI='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)