UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'AqIoJN1UUS1oRZUlM7Fo+XrUoi+/8HGUEMKQXRA9Btw='
WHERE
key_id = 'f131e73783b73060455dde898cf6b34d7a289fe1c4a9bec545148a91498e5fc5'
AND (
token = 'AqIoJN1UUS1oRZUlM7Fo+XrUoi+/8HGUEMKQXRA9Btw='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)