UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'f5hg7iyMbHxATR3vEshYshUGGQ1v72ZJa1D7yEEZk7U='
WHERE
key_id = 'd07a17fd0df24614764d5d9b6f98942121c3de71ec8e69bd3cd5220912d341ce'
AND (
token = 'f5hg7iyMbHxATR3vEshYshUGGQ1v72ZJa1D7yEEZk7U='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)