UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'BRigxHTG9MlnF68Jd2Pah6OLdsXhAJAymCMCaylvLxM='
WHERE
key_id = '95c013996941bf97cb9761406727a9e8de46c65f8595526f051c957af1c8a837'
AND (
token = 'BRigxHTG9MlnF68Jd2Pah6OLdsXhAJAymCMCaylvLxM='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)