UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '8Y2KZy2DsUU2Oa8dLnsr2zXFZY6UDW/WPTBDUcnqajc='
WHERE
key_id = '13245c4a0c829a0d05529a9e6a819346c7d809a6227b7966b4b6b95f04d7db02'
AND (
token = '8Y2KZy2DsUU2Oa8dLnsr2zXFZY6UDW/WPTBDUcnqajc='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)