UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'j8rLRJUeEMwPutBSVfOY+cC4jbVogWwsf+Rwmu0cZak='
WHERE
key_id = '3de70921cb9830a43743013e65fb7a07047dd85e10fab104cc273ecd491f3290'
AND (
token = 'j8rLRJUeEMwPutBSVfOY+cC4jbVogWwsf+Rwmu0cZak='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)