UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'a1Wfx2s6pz3Ug3qK974cIGSiTrhtwwZqNftM2C1iWFQ='
WHERE
key_id = '7691fc98147ee4ad94a76c66c1aacc8a248a0f0af85bee832bdcaa53a0f4b890'
AND (
token = 'a1Wfx2s6pz3Ug3qK974cIGSiTrhtwwZqNftM2C1iWFQ='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)