UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '4qlufgMUSIinFWtU6brvL5KB9cVIpNaIzh+g1Xpieo4='
WHERE
key_id = 'a3645b222081578f77355de2621f5a1f7fb9ee2fba102bf5ca84151b72e7fd8f'
AND (
token = '4qlufgMUSIinFWtU6brvL5KB9cVIpNaIzh+g1Xpieo4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)