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