UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '8fYw1busjH6giDZNC6+gHXKF9S3NDBuwMKWKqzzPNN4='
WHERE
key_id = '2a1142cd7bd3c1191b7ca6139f3d42622ba00c6c6ea3ddb9f8b6ae85f1ffb563'
AND (
token = '8fYw1busjH6giDZNC6+gHXKF9S3NDBuwMKWKqzzPNN4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)