UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'd1quPTYxS/YjYMgNfQdOzubdo7Hj318mncgQCaLKyjM='
WHERE
key_id = 'a604c4f4b826794dddd5f90ceef4c1e361e026857d4ff3b2f3776830cc4a8e06'
AND (
token = 'd1quPTYxS/YjYMgNfQdOzubdo7Hj318mncgQCaLKyjM='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)