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