UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'NXiGA7sYEn1+2eMEdSDfSAIBW1mJMEES7Hr0DD00SB8='
WHERE
key_id = '1605b0751c1b6f59dc00568306e0b85756416b30f5a58dc705d37846155fca73'
AND (
token = 'NXiGA7sYEn1+2eMEdSDfSAIBW1mJMEES7Hr0DD00SB8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)