UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'xyM5hpc7h4vizCeyVtpyBgm8PAFC+3cSuRbnv7/SeRc='
WHERE
key_id = '8cfccc74960e0fb77404df2bdf180c9f3ee16497ac9c7efcbf4980ef711f6a49'
AND (
token = 'xyM5hpc7h4vizCeyVtpyBgm8PAFC+3cSuRbnv7/SeRc='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)