UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'KM7tke/WwSv3M/kluAZk5+TfcWKJ6/6/16ILN49/q3o='
WHERE
key_id = '0b5af98947eedebaf3f3e997c791f9bb16bae7773a7f2df887365dafee147466'
AND (
token = 'KM7tke/WwSv3M/kluAZk5+TfcWKJ6/6/16ILN49/q3o='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)