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