UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'o+UgBhTo90ymd5aMrMJbSbAAOmG6iGWi2jUGo7kaVOE='
WHERE
key_id = '3991fd4925c52be529c215ddd824ddbcf36b1ac5b6b997b4346a6799d2e172f1'
AND (
token = 'o+UgBhTo90ymd5aMrMJbSbAAOmG6iGWi2jUGo7kaVOE='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)