UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'Yf66W91h4/tqpRt8LEZXq3k6xkvG9EyAgZwcFamZWjw='
WHERE
key_id = 'a4e9f4986b0d33f489aa42356224a2bff7f15291e86d490287e5f0fb48d7ef41'
AND (
token = 'Yf66W91h4/tqpRt8LEZXq3k6xkvG9EyAgZwcFamZWjw='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)