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