UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'bki6U/jeMYvtJVydAqyMsWvGsLT8qSFW2a+qvaHfQAc='
WHERE
key_id = '9318157e33b3a56a501e830ec3a5076dd614b482249f6b92017c94640eb1277c'
AND (
token = 'bki6U/jeMYvtJVydAqyMsWvGsLT8qSFW2a+qvaHfQAc='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)