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