UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'qPbLd+pvwdcng6mA0Kxy7m7NMJjF5BvXuJjLO4CSEG4='
WHERE
key_id = '7ff27f8e5024dc121423a3e41e22f220f44b881f1ff22b746b87b33ed4783a5c'
AND (
token = 'qPbLd+pvwdcng6mA0Kxy7m7NMJjF5BvXuJjLO4CSEG4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)