UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'Mb8G4HfDkcXqSaEPKj0FCi3zErAzAvSFClqJO5gmQ60='
WHERE
key_id = '1e42a05874df78c340742d354d840a7bd240cd95e2258a4dd1646510ccd58891'
AND (
token = 'Mb8G4HfDkcXqSaEPKj0FCi3zErAzAvSFClqJO5gmQ60='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)