UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'EgCpWd5Eu4XwGN8dZ250O2rCiqDSA7s5S1V8VHMdtjk='
WHERE
key_id = 'f2bab303c717e34dd80c0544455694157ae4972a8c18ae8dd78c47dd6472eede'
AND (
token = 'EgCpWd5Eu4XwGN8dZ250O2rCiqDSA7s5S1V8VHMdtjk='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)