UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'ZCK+RnHeZjik9Dr7doKDx6SFEPcOdu5E+9vpHV24RWM='
WHERE
key_id = 'f7ca202b62ac05dade6453e16748a988249642b7c5ef19fc2dd0796736f81c92'
AND (
token = 'ZCK+RnHeZjik9Dr7doKDx6SFEPcOdu5E+9vpHV24RWM='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)